<template>
  <div>
    <tableComponents :pagination="{currentPage,pageSize,total:list.all_num}" @handleCurrentChange="handleCurrentChange" @handleSizeChange="handleSizeChange" @sendUserSearch="getSearch" :searchData="userSearchData" :isHaveExport="false" :isHaveAdd="false">
      <template v-slot:table>
        <el-table ref="multipleTable" :data="list.data" v-loading="loading" stripe header-row-class-name="head_color" tooltip-effect="dark" style="width: 99.8%">
          <!-- <el-table-column label="币种" min-width="40">
            <template slot-scope="scope">
              <div class="tab_div">
                <div>
                  <span class>{{ scope.row.iden || '---'}}</span>
                </div>
              </div>
            </template>
          </el-table-column> -->
          <!-- <el-table-column prop="picture" header-align="center" align="center" min-width="160" label="图片">
            <template slot-scope="scope">
              <el-popover placement="right" title trigger="hover">
                <img :src="scope.row.piclink" style="width: 500px" />
                <img slot="reference" :src="scope.row.piclink" :alt="scope.row.piclink" style="width: 100px" />
              </el-popover>
            </template>
          </el-table-column>
          <el-table-column prop="picture" header-align="center" align="center" min-width="160" label="产品名称">
            <template slot-scope="scope">
              <div>
                {{scope.row.title}}
              </div>
            </template>
          </el-table-column> -->
          <el-table-column label="买方" min-width="80">
            <template slot-scope="scope">
              <div class="img_bor_tx">
                <img :src="$fnc.getImgUrl(scope.row.buy_avatar)" alt />
              </div>
            </template>
          </el-table-column>

          <el-table-column label min-width="190">
            <template slot-scope="scope">
              <div class="tab_div">
                <div>
                  <span>用户昵称：</span>
                  <span>{{scope.row.buy_nickname || '----'}}</span>
                </div>
                <div>
                  <span>会员账号：</span>
                  <span>{{scope.row.buy_username}}</span>
                </div>
                <div>
                  <span>买入订单：</span>
                  <span>{{scope.row.buy_oid}}</span>
                </div>
                <div>
                  <span>买入价格：</span>
                  <span>{{Number(scope.row.buy_price)}}</span>
                </div>
              </div>
            </template>
          </el-table-column>

          <el-table-column label="卖方" min-width="80">
            <template slot-scope="scope">
              <div class="img_bor_tx">
                <img :src="$fnc.getImgUrl(scope.row.sell_avatar)" alt />
              </div>
            </template>
          </el-table-column>

          <el-table-column label min-width="190">
            <template slot-scope="scope">
              <div class="tab_div">
                <div>
                  <span>用户昵称：</span>
                  <span>{{scope.row.sell_nickname || '----'}}</span>
                </div>
                <div>
                  <span>会员账号：</span>
                  <span>{{scope.row.sell_username}}</span>
                </div>
                <div>
                  <span>卖出订单：</span>
                  <span>{{scope.row.sell_oid}}</span>
                </div>
                <div>
                  <span>卖出价格：</span>
                  <span>{{Number(scope.row.sell_price)}}</span>
                </div>
              </div>
            </template>
          </el-table-column>
        </el-table>
      </template>
    </tableComponents>
  </div>
</template>
<script>
import HeadTitle from "@/components/currency/HeadTitle.vue";
import { recordSearchData } from "@/assets/js/searchData/searchData"; //引入搜索的数据
export default {
  data() {
    return {
      userSearchData: recordSearchData,
      show: false,
      myshow: false,
      loading: false,
      list: [],
      allPage: 0,
      allNum: 0,
      pageSize: 10,
      currentPage: 1,
      editId: "",
      multipleSelection: "",
      arr: [],
      visible: false,
      clickNum: 1,
      updataIndex: "",
      searchAll: {},
      dioForm: false,
      form: {
        id: "",
        point: "",
        rf: "",
      },
      end: false,
    };
  },
  components: {
    HeadTitle,
  },
  methods: {
    showAddDialog() {
      this.show = true;
    },
    getSearch(obj) {
      this.searchAll = obj;
      this.$router.push(this.$route.path + "?page=" + 1);
      this.getNewsAll(obj);
    },
    getNewsAll(data) {
      this.loading = true;
      var params = {};
      data = data || {};
      params = data;
      params.buy_oid = this.$route.query.buy_oid || "";
      params.sell_oid = this.$route.query.sell_oid || "";
      this.$api.getOc.getRecord(params).then((res) => {
        if (res.data.code == 200) {
          this.list = res.data.result;
        }
        this.loading = false;
      });
    },
    handleSizeChange(val) {
      var params = this.searchAll;
      params.page = "";
      params.page_size = val;
      this.getNewsAll(params);
      this.pageSize = val;
      // console.log(`每页 ${val} 条`);
    },
    handleCurrentChange(val) {
      if (this.$route.query.buy_oid) {
        this.$router.push(
          this.$route.path +
            "?page=" +
            val +
            "&buy_oid=" +
            this.$route.query.buy_oid
        );
      } else if (this.$route.query.buy_oid) {
        this.$router.push(
          this.$route.path +
            "?page=" +
            val +
            "&sell_oid=" +
            this.$route.query.sell_oid
        );
      } else {
        this.$router.push(this.$route.path + "?page=" + val);
      }
    },
    showEditDialog(id) {
      this.myshow = true;
      this.editId = id;
      this.clickNum++;
    },
    reload(id) {
      this.getNewsAll();
    },
  },

  created() {
    this.getNewsAll();
  },
  computed: {},
  watch: {
    $route() {
      var params = this.searchAll;
      params.page = this.$route.query.page || 1;
      params.page_size = this.pageSize;
      this.getNewsAll(params);
      this.currentPage = Number(this.$route.query.page) || 1;
    },
  },
};
</script>

<style lang="less" scoped>
thead > tr > th {
  height: 45px;
  line-height: 45px;
}
td,
th {
  border: 1px solid #e1e3e4;
  font-size: 12px;
}
th {
  background: #f8f8f8;
  font-weight: normal;
  color: #323437;
}
td {
  height: 75px;
  color: #000;
}
.caozuo {
  padding-left: 50px;
}
.pl {
  padding-left: 15px;
}
.chkBox {
  display: block;
  margin: 0 auto;
  width: 18px;
  height: 18px;
  background: #fff;
}
.aBtn_1 {
  padding: 10px;
}
</style>
